<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  
  <body>
   <div class="easyui-panel" data-options="border:false" style="padding: 6px">
		<form action="${ctx}/business/projectmanage/leader/exportAllFile" method="post" id="pigeonholeForm">
			<input type="hidden" name="projectId" value="${projectId }"/>
			<div class="easyui-panel" data-options="border:true,title:'项目基本资料'" style="padding:6px;margin-bottom: 6px">
				<table class="infoTable">
					<tbody>
						<tr>
							<td width="15%" style="background:#EDF4FB;padding-left: 38px;"><input type="checkbox" id="allProject" name="allProject" onclick="selectAll('resIds','allProject');"/>全选</td>
							<td width="35%" align="center" style="background:#EDF4FB">
								资料类型
							</td>
							<td width="50%" align="center" style="background:#EDF4FB">
								资料名称
							</td>
						</tr>
						<c:forEach var="fileType" items="${projectFileList }">
							<tr>
								<th width="15%" style="text-align: center;">
									<input type="checkbox" class="resIds" name="resIds" value="${fileType.value }" id="subcheck" onclick="setSelectAll('resIds','allProject');"/>
								</th>
								<td align="center" style="background:#EDF4FB" width="35%">${ fileType.name} </td>
								<td style="border-left: none" width="50%">
									<c:if test="${fileType.value!=101&&fileType.value!=102}">
										<c:forEach items="${resList}" var="res">
											<c:if test="${res.functionFlog==fileType.value}">
												<div>${res.oldName}</div>
											</c:if>
										</c:forEach>
									</c:if>
									<c:if test="${fileType.value==101}">
										<c:forEach items="${shotPauseResList}" var="res">
											<div>${res.oldName}</div>
										</c:forEach>
									</c:if>
									<c:if test="${fileType.value==102}">
										<c:forEach items="${bidPauseResList}" var="res">
											<div>${res.oldName}</div>
										</c:forEach>
									</c:if>
								</td>
							</tr>

						</c:forEach>
						
					</tbody>
				</table>
			</div>
			
			<c:if test="${isBuyer }">
				<div class="easyui-panel" data-options="border:true,title:'中标人资料'" style="height:260px;padding: 4px;margin-bottom: 6px">
			</c:if>
			<c:if test="${!isBuyer }">
				<div class="easyui-panel" data-options="border:true,title:'投标人资料'" style="height:260px;padding: 4px;margin-bottom: 6px">
			</c:if>				
					<table class="infoTable">
						<tr>
							<td width="15%" style="background:#EDF4FB;padding-left: 53px;">
								<input type="checkbox" id="SelectAll" name="allBidder" onclick="selectAll('bidderIds','SelectAll');"/>全选
							</td>
							<td width="60%" align="center" style="background:#EDF4FB">
								投标单位
							</td>
						</tr>
						<c:forEach var="bidInfo" items="${bidInfoList }" >
							<c:if test="${isBuyer&&project.winningId==bidInfo.userId }"><!-- 为采购人时 -->
							<tr>
								<th width="15%" style="text-align: center;">
									<input type="checkbox" class="bidderIds" name="bidderIds" value="${bidInfo.userId }" id="subcheck" onclick="setSelectAll('bidderIds','SelectAll');"/>
								</th>
								<td align="center" width="60%">
									${bidInfo.bidderName }
								</td>
							</tr>
							</c:if>
							<c:if test="${!isBuyer }">
							<tr>
								<th width="15%" style="text-align: center;">
									<input type="checkbox" class="bidderIds" name="bidderIds" value="${bidInfo.userId }" id="subcheck" onclick="setSelectAll('bidderIds','SelectAll');"/>
								</th>
								<td align="center" width="60%">
									${bidInfo.bidderName }
								</td>
							</tr>
							</c:if>
						</c:forEach>
					</table>
			</div>
		</form>
	</div>
	<div id="bindPicDialog"></div>
	<div id="selPicDialog"></div>
	<div id="noCompetReasonDialog"></div>
</body>
	<script type="text/javascript">
		//初始化表格对应的js对象
		var projectsParamObj;
		$(function() {
			//初始化表格对象数据
			projectsParamObj = new initParams(
					{
						paramObjName : 'projectsParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listProjectsTable',
						addDataFormId:'addProjectsDataForm',
						showDialogId:'firstLevelDialog',
						searchID:'searchProjects',
						resetSearchID:'resetsearchProjects',
						searchFormID:'searchProjectsForm',
						updateUrl:"${ctx}/business/projectmanage/input?projectId=",
						deleteUrl:'${ctx}/business/projectmanage/remove',
						addDialogWidth:700,
						addDialogHeight:520,
						ctx:'${ctx}',
						addDialogTitle:'采购项目信息'
					});
			//初始化查询
			init(projectsParamObj);
		});
		
		/**
		* 资料文件名
		*/
		function getResList(){
			//,formatter:getResList
		}
	
		$("#allBidder").click(function(){
			selectAll($(this),$(".bidderIds"));
		});
		
		
		/**
		 * 全选，反选
		 * @param {Object} claxx ： 子checkbox的class
		 * @param {Object} allId ： 全选的checkboxid
		 */
		function selectAll(claxx,allId){  
		    if ($("#"+allId).attr("checked")) {  
		        $("."+claxx+":checkbox").attr("checked", true);  
		    } else {  
		        $("."+claxx+":checkbox").attr("checked", false);  
		    }  
		}  
		 
		/**
		 * 子复选框的事件  
		 * @param {Object} claxx ： 子checkbox的class
		 * @param {Object} allId ： 全选的checkboxid
		 */
		function setSelectAll(claxx,allId){  
		    //当没有选中某个子复选框时，SelectAll取消选中  
		    if (!$("#subcheck").checked) {  
		        $("#"+allId).attr("checked", false);  
		    }  
		    var chsub = $("."+claxx+":input[type='checkbox'][id='subcheck']").length; //获取subcheck的个数  
		    var checkedsub = $("."+claxx+":input[type='checkbox'][id='subcheck']:checked").length; //获取选中的subcheck的个数  
		    if (checkedsub == chsub) {  
		        $("#"+allId).attr("checked", true);  
		    }  
		}  
	</script>